<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body,
        html {
            position: relative;
            height: 100vh;
            width: 100vw;
            overflow: hidden;
        }

        * {
            padding: 0;
            margin: 0;
        }

        header {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 300px;
            background-color: #f1f1f1;
            max-height: 300px;
            min-height: 80px;
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .container {
            display: flex;
            justify-content: center;
            height: calc(100vh - 80px);
            position: relative;
            background-color: #f1f1f1;
        }

        aside {
            flex: 1;
            background-color: #d8d8d8;
            position: sticky;
            top: 0;
            height: inherit;
        }

        .goods {
            flex: 3;
            background-color: #bfbfbf;
            height: inherit;
            padding: 8px 10px;
            box-sizing: border-box;
        }

        ul {
            height: 120vh;
        }

        li {
            width: 100%;
            line-height: 80px;
            text-align: center;
            background-color: #fafafa95;
        }

        li:not(:first-child) {
            margin-top: 10px;
        }
    </style>
</head>

<body>
    <header>
        <h1>PICTURE</h1>
    </header>
    <main class="container">
        <aside>
            left
        </aside>
        <main class="goods">
            <ul>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
                <li>123</li>
            </ul>
        </main>
    </main>
</body>

</html>

<script>
    const header = document.querySelector('header');
    const goods = document.querySelector('.goods');
    let startY = 0, endY = 0, count = 0;
    let { minHeight } = getComputedStyle(header)
    minHeight = parseInt(minHeight.match(/\d+/)[0]);

    document.addEventListener('touchstart', event => startY = event.touches[0].clientY);

    document.addEventListener('touchmove', (event) => {
        endY = event.touches[0].clientY;
        let distance = Math.abs(endY - startY);
        const { height } = header.getBoundingClientRect();
        if (endY > startY) {
            if (distance > 0) {
                startY = endY;
            }
            count -= distance
            goods.scrollTo({ top: count });

            if (count <= 0) {
                count = 0
                goods.style.overflowY = 'hidden';

                header.style.height = `${height + distance}px`;
                let currtHeight = header.style.height
                if (parseInt(currtHeight.match(/\d+/)[0]) >= minHeight) {
                    header.innerHTML = `<h1>PICTURE</h1>`;
                }
            }
        }
        else {

            if (distance > 0) {
                header.style.height = `${height - distance}px`;
                startY = endY;
            }
            let currtHeight = header.style.height

            if (parseInt(currtHeight.match(/\d+/)[0]) <= minHeight) {
                header.innerHTML = `<h1>NAV</h1>`;
                goods.style.overflowY = 'scroll';
                count += distance
                goods.scrollTo({ top: count });
            }
        }
    });

</script>